<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>轮换图&pagination页码</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    body {
      width: 100vw;
      height: 100vh;
      background: #2c3e50;
      display: grid;
    }
    main {
      width: 400px;
      height: 200px;
      align-self: center;
      justify-self: center;
      background: cornflowerblue;
      overflow: hidden;
      position: relative;
    }
    section {
      width: 1600px;
      height: 100%;
      display: grid;
      grid-template: 1fr/repeat(4, 400px);
      color: white;
      animation-name: slide;
      animation-duration: 4s;
      animation-timing-function: steps(4, end);
      animation-iteration-count: infinite;
    }
    @keyframes slide {
      to {
        transform: translateX(-1600px);
      }
    }
    section:hover, section:hover + ul::after {
      animation-play-state: paused;
    }
    ul {
      width: 200px;
      position: absolute;
      left: 50%;
      bottom: 10px;
      transform: translateX(-50%);
      list-style: none;
      display: grid;
      grid-template: 1fr/repeat(4, 1fr);
      justify-items: center;
    }
    ul li {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: rgba(0, 0, 0, .3);
      display: grid;
      justify-items: center;
      align-items: center;
      color: #fff;
      cursor: pointer;
    }
    ul::after {
      content: '';
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: #e74c3c;
      position: absolute;
      left: 10px;
      z-index: -1;
      animation-name: num;
      animation-duration: 4s;
      animation-iteration-count: infinite;
      animation-timing-function: steps(4, end);
    }
    @keyframes num {
      to {
        transform: translateX(200px);
      }
    }
  </style>
</head>
<body>
  <main>
    <section>
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
    </section>
    <ul>
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
    </ul>
  </main>
</body>
</html>